package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.system.domain.MyCommodity;
import com.ruoyi.system.domain.MyConsumerData;
import com.ruoyi.system.mapper.MyCommodityMapper;
import com.ruoyi.system.mapper.MyConsumerDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MyOrderMapper;
import com.ruoyi.system.domain.MyOrder;
import com.ruoyi.system.service.IMyOrderService;

import javax.annotation.Resource;

/**
 * 订单信息Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-16
 */
@Service
public class MyOrderServiceImpl implements IMyOrderService
{
    @Resource
    private MyOrderMapper myOrderMapper;

    @Resource
    private MyConsumerDataMapper myConsumerDataMapper;

    @Resource
    private MyCommodityMapper myCommodityMapper;

    /**
     * 查询订单信息
     *
     * @param id 订单信息主键
     * @return 订单信息
     */
    @Override
    public MyOrder selectMyOrderById(Long id)
    {
        return myOrderMapper.selectMyOrderById(id);
    }

    /**
     * 查询订单信息列表
     *
     * @param myOrder 订单信息
     * @return 订单信息
     */
    @Override
    public List<MyOrder> selectMyOrderList(MyOrder myOrder)
    {
        return myOrderMapper.selectMyOrderList(myOrder);
    }

    /**
     * 新增订单信息
     *
     * @param myOrder 订单信息
     * @return 结果
     */
    @Override
    public int insertMyOrder(MyOrder myOrder)
    {
//        List<MyConsumerData> myConsumerData = myConsumerDataMapper.selectMyConsumerDataList(new MyConsumerData());
//
//        List<MyCommodity> myCommodities = myCommodityMapper.selectMyCommodityList(new MyCommodity());

//        MyOrder order =new MyOrder();

//        myOrder.setMyCommodity(myCommodities);
//        myOrder.setMyConsumerDate(myConsumerData);

        return myOrderMapper.insertMyOrder(myOrder);
    }

    /**
     * 修改订单信息
     *
     * @param myOrder 订单信息
     * @return 结果
     */
    @Override
    public int updateMyOrder(MyOrder myOrder)
    {
        return myOrderMapper.updateMyOrder(myOrder);
    }

    /**
     * 批量删除订单信息
     *
     * @param ids 需要删除的订单信息主键
     * @return 结果
     */
    @Override
    public int deleteMyOrderByIds(Long[] ids)
    {
        return myOrderMapper.deleteMyOrderByIds(ids);
    }

    /**
     * 删除订单信息信息
     *
     * @param id 订单信息主键
     * @return 结果
     */
    @Override
    public int deleteMyOrderById(Long id)
    {
        return myOrderMapper.deleteMyOrderById(id);
    }
}
